XSP.submitLatency = 60000;

dojo.addOnLoad(function(){
	WindowSize().fillHeight();
	var scanForUpdates = function() {
		var targetNode = null;
		dojo.query(".lotusColLeft").forEach(function(thisNode) {
			targetNode = thisNode;
		});
		if (targetNode) {
			dojo.query(".buttonScanForUpdates").forEach(function(thisButton){
				dojo.byId(thisButton.id).click();
			});
		}
	};
	scanForUpdates();
	window.setInterval(scanForUpdates, 30000);
});

function WindowSize() {
	var myHeight = dojo.doc.documentElement.clientHeight;
	var myWidth = dojo.doc.documentElement.clientWidth;
	var getClassHeight = function(cssClass) {
		var classHeight;
		dojo.query("." + cssClass).forEach(function(thisNode){
			classHeight = dojo.style(thisNode, "height");
		});
		return Number(classHeight);
	};
	var bannerHeight = getClassHeight("lotusBanner");
	var titleHeight = getClassHeight("lotusTitleBar");
	var footerHeight = getClassHeight("lotusFooter");
	var myAvailableHeight = myHeight - (bannerHeight + titleHeight + footerHeight + 70);
	return {
	  	getAvailableHeight: function() {return myAvailableHeight;},
	  	getHeight: function() {return myHeight;},
	  	getWidth: function() {return myWidth;},
	  	fillHeight: function() {
	  	// the following line causes problems with height for Main
	  		//dojo.query(".lotusMain, .lotusColLeft, .lotusContent").style("height", (myAvailableHeight + "px"));
	  		dojo.query(".subscriptionList").style("height", (myAvailableHeight - 47) + "px");
		}
	};
}
